<?php
/**
 * 看板展示
 */
namespace app\mp\home;
use app\common\controller\Common;
use app\common\service\FactoryOutgo as FactoryOutgoService;
use app\common\service\Order as OrderService;
use app\common\service\OrderSize as OrderSizeService;
use app\common\service\Sku as SkuService;
use think\Db;

class Board extends Common
{
	protected $factoryOutgoId = 0;

	public function initialize() {
		parent::initialize();

		$this->view->engine->layout('layout_full');

	/*	$code = $this->request->param('code/s');
		$factoryOutgoInfo = (new FactoryOutgoService())->getInfoByCode($code);
		if (!$factoryOutgoInfo) {
			header('content-type:text/html;charset=utf-8');
			header('HTTP/1.1 401 Unauthorized');
			exit('无权限访问');
		} elseif ($factoryOutgoInfo && $factoryOutgoInfo['status'] == 0) {
			header('content-type:text/html;charset=utf-8');
			header('HTTP/1.1 403 Forbidden');
			exit('该链接已禁止访问');
		}
		$this->factoryOutgoId = $factoryOutgoInfo['id'];
		$this->assign('factoryOutgoId', $factoryOutgoInfo['id']);
		$this->assign('factoryOutgoName', $factoryOutgoInfo['name']);
		$this->assign('code', $code);*/

		$this->assign('hisiCurMenu', ['title' => '']);
		$this->assign('hisiHead', '');
	}



	/**
	 * 展示看板
	 */
    public function index()
    {
        if ($this->request->isAjax()) {
            $address_id = $this->request->param('address_id','1');
            $address_id=$address_id !=''?$address_id:1;
            $BoardService=new \app\common\service\Board();
            //获取看板数据
            $data=$BoardService->getBoardData($address_id);
            return json($data);
        }

        return $this->fetch();
    }

    /**
     * 展示视频
     * @author  huanghuixiang
     * @date 2022/12/9 16:45
     */
    public function showVideo(){
        return $this->fetch();
    }



    /**
     * 输出layui的json数据
     *
     * @param array $data
     * @param integer $count
     * @return void
     */
    protected function Json($code=1, $msg='', $data=[], $count=0)
    {
        if (empty($msg)) {
            $msg = $code == 1 ? '操作成功' : '操作失败';
        }
        return json(['code' => $code, 'msg' => $msg, 'data' => $data, 'count' => $count]);
    }

}